function ajax(mentd, url, obj, ch) {
    var str = ''
    for (const key in obj) {
        str += `${key}=${obj[key]}&`
    }
    str=str.slice(0,str.length-1)
    var xhr=new XMLHttpRequest()
    xhr.open(mentd,mentd=='get'?url+'?'+str:url)
    xhr.onreadystatechange=function(){
        if(xhr.readyState==4){
            ch(JSON.parse(xhr.responseText))
        }
    }
    xhr.setRequestHeader('content-type','application/x-www-form-urlencoded')
    xhr.send(mentd=='get'?null:str)
}